<template>
    <div>
        <h1>登录</h1>
        <table class="table">
            <tbody>
                <tr>
                    <td>用户名：</td>
                    <td>
                        <input type="text" v-model="data.hoseName">
                    </td>
                </tr>
                <tr>
                    <td>密码：</td>
                    <td>
                        <input type="password" v-model="data.pwd">
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="button" value="登录" @click="Login">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import {ref} from 'vue';
import axios from 'axios';
const data=ref({
    "hoseId": 0,
    "hoseName": "",
    "pwd": "",
    "hosePicr": 0,
    "typeName": "",
    "hpseImg": "",
    "zhuangtai": true
})
const Login=()=>{
    axios.get("https://localhost:7164/api/Hose/Login",{params:data.value}).then(res=>{
        if(res.data.hoseId==-1)
        {
            alert("用户名错误！");
            return;
        }
        if(res.data.hoseId==-2)
        {
            alert("密码错了！");
            return;
        }
            if(res.data.hoseId>0)
        {
            alert("登录成功！");
            location.href="/Show";
        }
    })
}
</script>

<style scoped>

</style>